package com.itheima.d2_array;


import java.util.Random;

public class Test14 {
    public static void main(String[] args) {
        int[] num = new int[20];
        Random rand = new Random();
        for (int i = 0; i < num.length; i++) {
            num[i] = rand.nextInt(100);
            System.out.println(num[i]);
        }
        int max = num[0];
        for (int a = 1; a < num.length; a++) {
            if (num[a] > max){
                max = num[a];
            }
        }
        System.out.println("最大值"+max);

        System.out.println("----------------------");

        int min = num[0];
        for (int a = 1; a < num.length; a++) {
            if (num[a] < min){
                min = num[a];
            }
        }
        System.out.println("最大值"+min);

    }
}
